import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 求1！+2！+3！+4！+........+n!的和
 * Author:  LiuTao
 * Version: 1.0
 * Date:    2023-04-18  13:00
 */
public class Test2 {
    public static int fac(int n) {
        int sum = 1;
        for (int i = 1; i <= n; i++) {
            sum *= i;
        }
        return sum;
    }
    public static int facnum(int n) {
        int ret = 0;
        for (int i = 1; i <= n; i++) {
            ret += fac(i);
        }
        return ret;
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(facnum(n));
        scanner.close();
    }
}
